//
//  BTELoginTool.swift
//  BTE
//
//  Created by 张文 on 2025/8/30.
//


import UIKit
import Alamofire
import SmartCodable





enum BTELoginTool_API: SERVER_NET_TYPE {
    
    case carneol([String:String])
    case qurshes([String:String])
    case geothermally([String:String])
    
    var ROOT: String {
        return ROOT_PATH
    }
    
    
    var PATH: String {
        switch self {
        case .carneol(let dictionary):
            return "/Blaugas/carneol"
        case .qurshes(let dictionary):
            return "/Blaugas/qurshes"
        case .geothermally(let dictionary):
            return "/Blaugas/geothermally"
        }
    }
    
    
    var METHOD: SERVER_NET_F {
        switch self {
        case .carneol(let dictionary):
            return .POST
        case .qurshes(let dictionary):
            return .POST
        case .geothermally(let dictionary):
            return .POST
        }
    }
    
    
    var TASK: SERVER_TASK {
        switch self {
        case .carneol(let dictionary):
            return .requestParameters(parameters:dictionary, encoding: URLEncoding.default)
        case .qurshes(let dictionary):
            return .requestParameters(parameters:dictionary, encoding: URLEncoding.default)
        case .geothermally(let dictionary):
            return .requestParameters(parameters:dictionary, encoding: URLEncoding.default)
        }
    }
    
    
    var HEADER: [String : String]? {
        return nil
    }
    
}




class BTELoginToolNetServer: BTEServiceTool<BTELoginTool_API> {
 
    func Carneol(data:[String:String],completion: @escaping (Result<NetBaseModel<BTECarneolModel>?, NetError>) -> Void) {
        fetchData(target: BTELoginTool_API.carneol(data), resultClass: NetBaseModel<BTECarneolModel>.self) { result in
            completion(result)
        }
    }
    
    func qurshes(data:[String:String],completion: @escaping (Result<NetBaseModel<BTECarneolModel>?, NetError>) -> Void) {
        fetchData(target: BTELoginTool_API.qurshes(data), resultClass: NetBaseModel<BTECarneolModel>.self) { result in
            completion(result)
        }
    }
    
    func geothermally(data:[String:String],completion: @escaping (Result<NetBaseModel<BTEGeothermallyModel>?, NetError>) -> Void) {
        fetchData(target: BTELoginTool_API.geothermally(data), resultClass: NetBaseModel<BTEGeothermallyModel>.self) { result in
            completion(result)
        }
    }
}







class BTECarneolModel: SmartCodable {
    required init(){}
}

class BTEGeothermallyModel: SmartCodable {
    var upbows: String?
    required init(){}
}
